package com.jcl.cloud.services.login.util;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringUtil {


    public static String getStrByRgex(String inputStr, String rgex) {

        Pattern pattern = Pattern.compile(rgex);// 匹配的模式
        Matcher m = pattern.matcher(inputStr);
        while (m.find()) {
            return m.group(1);
        }

        return "";
    }


    //href="/Candidate/ResumeView.aspx?
    public static List<String> getResumeViewUrlList (String html){
        List<String> urlList = new ArrayList<>();
        String regex = "href=\"/Candidate/ResumeView.aspx?(.*?)\"";
        String s = "";
        String url = "";
        String preUrl = "https://ehire.51job.com/Candidate/ResumeView.aspx";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(html);
        while (matcher.find()) {
            s = matcher.group(1);
            url = preUrl + s;
            urlList.add(url);
        }


        return  urlList;

    }
}
